home *** CD-ROM | disk | FTP | other *** search
/ Nejlepší hry / Nejlepsi hry.iso / hry / plane arcade / planearcade.exe / tank3.bmp / types.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-06-21  |  3.2 KB  |  146 lines

  1.  
  2. #ifndef _TYPES_H_
  3. #define _TYPES_H_
  4.  
  5.  
  6. //
  7. //VECTOR3D Ütruktura
  8. //
  9. struct VECTOR3D
  10. {
  11.     float X,Y,Z; //suradnice
  12.  
  13.  
  14. };
  15.  
  16. //
  17. //VECTOR2D Ütruktura
  18. //
  19. struct VECTOR2D
  20. {
  21.     float X,Y;
  22. };
  23.  
  24. //
  25. //COLOR Ütruktura
  26. //
  27. struct COLOR
  28. {
  29.     float R,G,B,A; 
  30. };
  31.  
  32.  
  33. //
  34. //PLANE Ütruktura
  35. //
  36. struct PLANE
  37. {
  38.     VECTOR3D Normal;
  39.     float D;
  40. };
  41.  
  42. //-----------------------------
  43. //DIRECTX
  44. //----------------------------
  45. D3DXMATRIXA16 GetMatrix(VECTOR3D Pos,VECTOR3D Rot,VECTOR3D Sca);
  46.  
  47. VECTOR3D      TransformPoint(VECTOR3D Point,D3DXMATRIXA16 Matica);
  48. PLANE         TransformPlane(PLANE Plane,D3DXMATRIXA16 Matica);
  49. VECTOR3D      TransformNormal(VECTOR3D Normal,D3DXMATRIXA16 Matica);
  50.  
  51. VECTOR3D      UnTransformPoint(VECTOR3D Point,D3DXMATRIXA16 Matica);
  52.  
  53. VECTOR3D      Project(VECTOR3D B);
  54. VECTOR3D      UnProject(VECTOR3D B);
  55.  
  56. D3DMATERIAL9  GetMaterial(COLOR Ambient,
  57.                           COLOR Diffuse,
  58.                           COLOR Specular,
  59.                           COLOR Emissive,float Power); 
  60.  
  61. inline DWORD FtoDW( FLOAT f ) { return *((DWORD*)&f); }
  62.  
  63. //-----------------------------
  64. //FPS
  65. //----------------------------
  66. extern float FPS ;   //presne FPS
  67. extern int   iFPS ;  //priblizne FPS
  68. extern __int64 counter1;
  69. extern __int64 counter2;
  70. extern __int64 freq;
  71.  
  72. void TimeStart();
  73. void TimeEnd();
  74. float Power(float Value);
  75. float PowerTime(float Value);
  76.  
  77. //----------------------------
  78. //COLOR
  79. //----------------------------
  80. COLOR GetColor(float R,float  G,float  B);
  81. COLOR GetColor(float A,float  R,float  G,float  B);
  82.  
  83. //----------------------------
  84. //VECTOR3D
  85. //----------------------------
  86.  
  87. VECTOR3D Get3D(float X,float Y,float Z);
  88. VECTOR2D Get2D(float X,float Y);
  89.  
  90. VECTOR3D RandomVector();
  91.  
  92. void Sub(VECTOR3D *V,VECTOR3D A,VECTOR3D B);
  93. void Add(VECTOR3D *V,VECTOR3D A,VECTOR3D B);
  94. void Mul(VECTOR3D *V,VECTOR3D A,VECTOR3D B);
  95. void Cross(VECTOR3D *V,VECTOR3D A,VECTOR3D B);
  96. float Absolute(VECTOR3D V);
  97. void Normalize(VECTOR3D *V);
  98. float Dot(VECTOR3D A,VECTOR3D B);
  99.  
  100.  
  101.  
  102.  
  103. //----------------------------
  104. //PLANE
  105. //----------------------------
  106.  
  107. PLANE GetPlane(VECTOR3D Normal,float D);
  108.  
  109. PLANE    CreatePlaneFace(VECTOR3D B1,VECTOR3D B2,VECTOR3D B3);
  110. PLANE    CreatePlanePoint(VECTOR3D B1,VECTOR3D B2);
  111. float      PointPlane(PLANE P,VECTOR3D B);
  112.  
  113. bool CalcPriesEdge(VECTOR3D *B,PLANE P,VECTOR3D B1,VECTOR3D B2);
  114. bool CalcPriesPlane(VECTOR3D *B,PLANE P1,PLANE P2,PLANE P3);
  115.  
  116. //----------------------------
  117. //COLLISION
  118. //----------------------------
  119. bool CollisionBoxEdge(VECTOR3D P1,VECTOR3D P2,VECTOR3D Min,VECTOR3D Max);
  120.  
  121.  
  122. //------------------------------
  123. //OSTATNE
  124. //------------------------------
  125. float CalcAngleCentre(VECTOR3D S,VECTOR3D P1, VECTOR3D P2);
  126. float CalcAngleVector(VECTOR3D P1, VECTOR3D P2);
  127.  
  128. float CalcDistance(VECTOR3D B1,VECTOR3D B2);
  129.  
  130. float RandomMinMax(float fMin,float fMax);
  131.  
  132. VECTOR3D GetRotationLok(VECTOR3D Pos, VECTOR3D Lok);
  133. VECTOR3D GetRotationSme(VECTOR3D Sme);
  134.  
  135. VECTOR2D EnvironmentMapping(VECTOR3D Point,
  136.                             VECTOR3D Normal,
  137.                             float Offset,
  138.                             D3DXMATRIXA16 ViewMatrix);
  139.  
  140. VECTOR2D BumpMapping(VECTOR3D Normal,VECTOR2D TexCoor,float Offset,
  141.                      D3DXMATRIXA16 ViewMatrix);
  142.  
  143. float FTRX(float Value);
  144. float FTRY(float Value);
  145.  
  146. #endif //_TYPES_H_